<template>
  <div>
    <div v-for="(item, index) in buttons" :key="item.code">
      <el-button type="text" size="small" @click="operateClick(item, index)" style="padding-top: 0;min-height: 10px">{{
          item.label
        }}
      </el-button>
    </div>
    <div v-for="(item, index) in operation" :key="item.code">
      <el-button type="text" size="small" @click="operateClick(item, index)" style="padding-top: 0;min-height: 10px">{{
          item.label
        }}
      </el-button>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    item: {
      type: Object,
      default() {
        return {}
      }
    }
  },

  computed: {

    order() {
      return this.item.basic.data.field || {}
    },

    operation() {
      let list = this.item.operation && this.item.operation.data.list || []
      return list
    },

    buttons() {
      let button = [
        {label: '详情', code: 'detail'},
        {label: '记录', code: 'operation'},
      ]
      return button
    }
  },

  methods: {
    showDetail(data) {
      this.$emit('show-detail', data.order_sn)
    },

    operateClick(item) {
      this.$emit('operate', this.order, item)
    },
  }
}
</script>
